   {Pseudotrans - Codificador de pseudocodigo a lenguaje pascal
    Copyright (C) 2006  Alejandro Lucas Baldres, Nicolas Secreto
    Copyright (C) 2011  Alejandro Lucas Baldres

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA}
(**************************************************************)
{PROGRAMACION: ALEJANDRO LUCAS BALDRÉS                         }
{Ultima modificación: 28/11/06                                 }
{LICENCIA: GNU/GPL                                             }
{--------------------------------------------------------------}
{Esta unida tiene los procedimiento de busqueda de instrucciones}
{Unit contain procedures of search of instructions}
{--------------------------------------------------------------}
{COMPILADO CON FREEPASCAL                                      }
//Comment Modify: 12/10/2011
unit Func_Busqueda;

interface
uses
Classes,operadores,SysUtils;
procedure Busco (var Cadena:TStrings;Directorio_pse:String);
var
FDiccionario:TstringList;//lista publica en donde se carga el diccionario / Public List when load the dictionary 
implementation
uses
main;

/////////////////////////////PSEUDOCODIGO UNPSJB (UNIV. NAC. PAT. SAN JUAN BOSCO
procedure Busco (var Cadena:TStrings;Directorio_pse:String);
  // TREGISTRO = [INTRUCCION_PASCAL],[INSTRUCCION_PSEUDOCODIGO],[OPCION1],[OPCION2],[OPCION3] 
 // TRegistro = [Pascal_Instruction], [Pseudocode_Instruction],[Option1],[Option2],[Option3]

 var
 aux2:ShortString;
 i,b:Integer;
 

 begin
//Creo la lista de cadenas y cargao el diccionario en ella / Create String List and load the dictionary in She
 FDiccionario:=TStringList.create;
 FDiccionario.LoadFromFile(Directorio_pse);//Cargo Diccionario // Load Dictionary
//Determino que tipo de pseudocódigo voy a utilizar / Determine what type of pseudocode uses
 if FDiccionario.Strings[0]='[BASIC]' then
	Tipo_Pseudocodigo:='B'
    else Tipo_Pseudocodigo:='P';
 for i:=0 to cadena.count-1 do //Recorro el pseudocodigo // around of pseudocode
 begin
 b:=0;
 while (b<=FDiccionario.count-1) do 
   		begin
                aux2:=Cadena.Strings[i];
	      	Cambio_Operadores (aux2,FDiccionario.Strings[b],FDiccionario.Strings[b+1],StrToInt(FDiccionario.Strings[b+2]),StrToBool(FDiccionario.Strings[b+3]),StrToBool(FDiccionario.Strings[b+4]));
		Cadena.Strings[i]:=aux2; //Asigno la palabra traducida / Asign the translate word	
		b:=b+5;
   		end;
  end;
 end;
/////////////////////////FIN PSEUDOCODIGO UNPSJB (UNIV. NAC. PAT. SAN JUAN BOSCO 
end.
